import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage'

////发票管理

//天眼查关键词搜索企业
export const getEntSearchTyc =
  (data) =>
    postAction(
      '/ent/searchTycEntInfo',
      data
    )

//校验企业名和信用代码是否正确
export const verifyCompanyCode =
  (data) =>
    postAction(
      '/cloud/third/tyc/verifyEntNameAndLicenceCreditCode',
      data
    )

//获取企业各种金额
export const getEntMoneyInfo =
  (data) =>
    getAction(
      '/taxConfig/getMoneyInfo?entId=' + data,
    )

//获取当季提醒限额
export const getEntQuarterAmount =
  (data) =>
    getAction(
      '/taxConfig/getInitQuarterAmount?entId=' + data,
    )

//发票税率梯度列表
export const getEntOrdinaryRate =
  (data) =>
    postAction(
      '/taxConfig/listConfigRate',
      data
    )

//获取企业可开票类型
export const getEntTaxType =
  (data) =>
    getAction(
      '/taxConfig/getEntTaxType?entId=' + data,
    )

//获取企业发票号段余量
export const getBillSegment =
  (data) =>
    getAction(
      '/billSegment/getEntBillSegment?entId=' + data,
    )

//获取企业发票号段详细余量
export const getMonthBillSegment =
  (data,invcId) =>
    getAction(
      '/billSegment/getEntMonthBillSegmentV2?entId=' + data + '&invcId=' + invcId,
    )

//查询收件信息
export const getMailList =
  (data) =>
    getAction(
      '/invc/queryMailList?entId=' + data,
    )

//查询邮箱信息
export const getEMailList =
  (data) =>
    getAction(
      '/invc/queryEMailList?entId=' + data,
    )

//查询受票方信息
export const getReceiveList =
  (data) =>
    getAction(
      '/invc/queryReceiveList?entId=' + data,
    )

//查询开票方信息
export const getSendList =
  (data) =>
    getAction(
      '/invc/querySendList?entId=' + data,
    )

//提交开票
export const saveTaxInvoice =
  (data) =>
    postAction(
      '/taxInvoice/createTaxInvoice',
      data
    )

//保存草稿
export const saveTaxInvoiceTem =
  (data) =>
    postAction(
      '/taxInvoice/createTaxInvoiceTem',
      data
    )

//预计算开票费用
export const calculatingExpenses =
  (data) =>
    postAction(
      '/taxInvoice/preCalTaxInvoiceChargeInfo',
      data
    )

//申请开票补缴预计算开票费用
export const calculatingPayExpenses =
  (data) =>
    postAction(
      '/taxInvoice/preCalTaxInvoiceChargeInfo2',
      data
    )

//获取是否有未完成的开票
export const getEntIncompleteTax =
  (data) =>
    getAction(
      '/taxInvoice/hasIncompleteTax?entId=' + data,
    )

//获取有支付中的订单
export const getChangeStepTax =
  (data) =>
    getAction(
      '/taxInvoice/findChangeStepTax?entId=' + data,
    )

//查询企业合同服务模式配置
export const getEntSvConf =
  (data) =>
    getAction(
      '/svm/mgr/queryEntSvConf?entId=' + data,
    )

//查询企业待变更的企业服务模式列表
export const getEntChange =
  (data) =>
    getAction(
      '/svm/mgr/queryEntToChange?entId=' + data,
    )

//待申请服务企业列表查询
export const getApplyList =
  (data) =>
    postAction(
      '/ent/info/queryApplyEntList',
      data
    )

//获取匹配的税率要求
export const getTaxConfig =
  (data) =>
    postAction(
      '/taxConfig/getMatchTaxConfig',
      data
    )

//开票列表
export const getTaxInvoiceList =
  (data) =>
    postAction(
      '/taxInvoice/list',
      data
    )

//待确认寄送
export const getConfirmDelivery =
  (data) =>
    getAction(
      '/taxInvoice/waitConfirmDelivery?id=' + data,
    )

//获取开票详情
export const getTaxInvoiceDetails =
  (data) =>
    postAction(
      '/taxInvoice/getTaxInvoiceInfo?id=' + data,
    )

//判断企业是否可以税务变更 0-否 1-是
export const getInvcTaxCheck =
  (data) =>
    getAction(
      '/taxbiz/taxSubCheck?entId=' + data,
    )

//判断企业是否可以开票 0-否 1-是
export const getInvcCheck =
  (data) =>
    getAction(
      '/invc/info/entInvcCheck?entId=' + data,
    )

//查询待支付的订单
export const queryTaxPayOrder =
  (data) =>
    getAction(
      '/taxInvoice/findTaxPayOrder?entId=' + data,
    )

//检查是否超限额(无在途票)
export const checkLimit =
  (entId,data) =>
    getAction(
      '/taxInvoice/checkLimitMoney?entId=' + entId + '&totalAmount=' + data,
    )

//检查是否超限额(有在途票)
export const checkTransitLimit =
  (entId,data) =>
    getAction(
      '/taxInvoice/checkWarnMoney?entId=' + entId + '&totalAmount=' + data,
    )


//开票列表  结算计算开票费用
export const calculatingBanchExpenses =
  (data) =>
    postAction(
      '/taxInvoice/preCalTaxInvoiceChargeInfo3',
      data
    )

//开票列表  开票结算
export const invoiceSettlement =
  (data) =>
    postAction(
      '/taxInvoice/createTaxInvoice1',
      data
    )

//取消开票支付单
export const returnInvoicePayOrder =
  (data) =>
    postAction(
      '/taxInvoice/cancelTaxInvoicePayOrder?payOrder=' + data,
    )

//查询发票订单记录快照
export const findPayOrderRecord =
  (data) =>
    getAction(
      '/taxInvoice/findTaxOrderRecordByPayOrder?payOrder=' + data,
    )

//获取发票变动记录
export const findPayOrderChangeRecord =
  (data) =>
    getAction(
      '/taxInvoice/findTaxOrderRecordBySerialNum',
      data
    )


//税务变更信息提交
export const getTaxInfoSub =
  (data) =>
    postAction(
      '/taxbiz/taxInfoSub',
      data
    )

//服务模式变更信息提交
export const getChangeSub =
  (data) =>
    postAction(
      '/svconfbiz/svConfChangeSub',
      data
    )

//退票
export const getInvoiceReturn =
  (data) =>
    postAction(
      '/taxInvoice/returnTaxInvoice',
      data
    )

//获取开票进度信息
export const getInvoiceProgress =
  (data) =>
    getAction(
      '/progress/queryInvoiceProgress?flowNo=' + data,
    )

//批量撤消
export const getInvoiceRevoke =
  (data) =>
    postAction(
      '/billSegment/invcCancle',
      data,
    )
// export const getInvoiceRevoke =
//   (data) =>
//     getAction(
//       '/taxInvoice/revoke?ids=' + data,
//     )

//票池取消检查
export const getInvcCancleCheck =
  (data) =>
    postAction(
      '/billSegment/invcCancleCheck',
      data
    )

//查询开票关联业务
export const getInvocieBiz =
  (data) =>
    getAction(
      '/svconfbiz/queryInvocieBiz?entId=' + data,
    )

//错票重开
export const saveTaxReopenInvoice =
  (data) =>
    postAction(
      '/taxInvoice/createRetryTaxInvoice',
      data
    )

//根据企业id获取开票类目信息
export const getIndustryinfo =
  (data) =>
    getAction(
      '/ent/all/industryinfo?entId=' + data,
    )

//根据企业id获取开票类目信息
export const getIndustryInfoChild =
  (data) =>
    postAction(
      '/ent/all/getAllCateGoryInfoChild',
      data,
    )

//是否存在未开票完成的票(查询该企业是否有“开票中”或“开票失败”状态的发票)
export const getNotFinishedTicket =
  (data) =>
    getAction(
      '/taxInvoice/hasNoIncompleteTax?entId=' + data,
    )

//检查数电额度是否一致
export const checkBatteryLimit =
  (data) =>
    getAction(
      '/taxInvoice/checkCreditLimit?entId=' + data,
    )

//接口开票查询开票人
export const queryInvoiceManage =
  (data) =>
    getAction(
      '/electron/issuer/onlineInvoice?entId=' + data,
    )

//开票员密码校验
export const userPasswordVerification =
  (data) =>
    postAction(
      '/electron/tax/password/checkEleTaxPassword',
      data,
    )

//开票员密码更新
export const userPasswordUpdate =
  (data) =>
    postAction(
      '/electron/tax/password/updateEleTaxPassword',
      data,
    )

//变更开票人并重试开票
export const queryInvoiceUser =
  (data) =>
    getAction(
      '/taxInvoice/changeInvoiceUser',
      data
    )

//查询发票文件
export const invoiceUploadFiles =
  (data) =>
    getAction(
      '/taxInvoice/searchUploadTax2',
      data
    )

//开票撤销
export const invoiceRevokeApplication =
  (data) =>
    getAction(
      '/taxInvoice/unfinishedInvoiceCancellation',
      data
    )

//撤销申请计算费用
export const invoiceRevokeCostInfo =
  (data) =>
    getAction(
      '/taxInvoice/preUnfinishedInvoiceCancellation',
      data
    )

//开票失败重新编辑提交
export const invoiceApplication =
  (data) =>
    postAction(
      '/taxInvoice/failedToReopen',
      data
    )


//获取开票人认证状态
export const getInvoiceUserFaceState =
  (data) =>
    getAction(
      '/electron/tax/password/getFaceState',
      data
    )

//获取是否需要人脸识别
export const getInvoiceWhetherUserFace =
  (data) =>
    getAction(
      '/electron/tax/password/queryFaceAuthState',
      data
    )

//开票人核验成功后回调重试开票
export const queryConfirmedVerified =
  (data) =>
    getAction(
      '/taxInvoice/checkFinish',
      data
    )



//获取当月开票金额
export const getMonthAmount =
  (data) =>
    getAction(
      '/taxConfig/getToMonthAmount?entId=' + data,
    )

//获取当季开票金额
export const getQuarterAmount =
  (data) =>
    getAction(
      '/taxConfig/getToQuarterAmount?entId=' + data,
    )

//获取最近一年开票金额
export const getYearAmount =
  (data) =>
    getAction(
      '/taxConfig/getToYearAmount?entId=' + data,
    )

//获取企业当季开票限额
export const getEntQuarterLimitAmount =
  (data) =>
    getAction(
      '/taxConfig/getEntQuarterLimitAmount?entId=' + data,
    )

//刷脸时获取开票信息
export const getBusinessCheckFaceInfo =
  (data) =>
    getAction(
      '/taxInvoiceCheck/getBusinessCheckFaceInfo',
      data,
    )

//获取个人刷脸认证url
export const getPersonRealSwipeUrl =
  (data) =>
   postAction(
      '/taxInvoiceCheck/getPersonRealSwipeUrl',
      data,
    )

//流水回单提交
export const turnFlowReceipt =
  (data) =>
    postAction(
      '/receipt/flowReceiptSub',
      data
    )



//开票核验获取认证链接
export const getInvoiceSignUrl =
  (data) =>
    postAction(
      '/taxInvoiceCheck/taxInvoiceCheckUrl',
      data,
    )

//退票验证获取验证地址
export const getInvoiceReturnSignUrl =
  (data) =>
    postAction(
      '/taxInvoiceCheck/taxReturnTicketCheckUrl',
      data,
    )

//把url转化成base64流的二维码
export const getInvoiceBaseUrl =
  (data) =>
    postAction(
      '/s/getUrlQRBase64',
      data,
    )

//开票核验发送短信
export const getTaxInvoiceCheckSendSms =
  (data) =>
    postAction(
      '/taxInvoiceCheck/taxInvoiceCheckSendSms',
      data,
    )

/**
 * 批量核验短信发送
 * @param {*} data
 * @returns
 */
export const getCatalogSignAuthSMS =
  (data) =>
    getAction(
      '/signAuth/catalogSignAuthSMS',
      data,
    )

//退票核验发送短信
export const getTaxReturnTicketBatchCheck =
  (data) =>
    postAction(
      '/taxInvoiceCheck/taxReturnTicketBatchCheck',
      data,
    )

//错票重开核验发送短信
export const getTaxReopenTicketCheck =
  (data) =>
    postAction(
      '/taxInvoiceCheck/taxInvoiceCheckSendSms4Reissue',
      data,
    )

//通过人脸核验
export const getVerification =
  (data) =>
    getAction(
      '/taxInvoice/passVerification?flowNo=' + data,
    )




//开票核验发送短信
export const getAuthCallback =
  (data) =>
    postAction(
      '/taxInvoiceCheck/real/auth/callback',
      data,
    )

//查询法人信息接口
export const queryLegalInfo =
  (data) =>
    postAction(
      '/legal/getLegalInfo',
      data,
    )

//修改法人实名手机号
export const updateLegalInfo =
  (data) =>
    postAction(
      '/legal/updateLegalPhone',
      data,
    )

/**
 * 批量开票验证发起及短信发送
 * @param {*} data
 * @returns
 */
export const taxInvoiceCatalogCheck =
  (data) =>
    postAction(
      '/taxInvoiceCheck/taxInvoiceCatalogCheck',
      data,
    )
/**
 * 根据发票id获取认证记录
 * @param {*} data
 * @returns
 */
export const taxInvoiceCatalogById =
  (data) =>
  getAction(
      '/taxInvoiceCheck/taxInvoiceCatalogById',
      data,
    )
/**
 * 发票待结算撤销创建（单张）
 * @param {*} data {id}
 * @returns
 */
export const taxSettleRevokedCheck =
  (data) =>
  getAction(
      '/taxInvoiceCheck/taxSettleRevokedCheck',
      data,
    )
/**
 * 发票待结算撤销创建（批量）
 * @param {*} data
 * @returns
 */
export const taxSettleRevokedBatchCheck =
  (data) =>
  postAction(
      '/taxInvoiceCheck/taxSettleRevokedBatchCheck',
      data,
    )
/**
 *  发票待结算撤销-短信发送（批量）
 * @param {*} data
 * @returns
 */
export const taxSettleRevokedBatchSMS =
  (data) =>
  postAction(
      '/taxInvoiceCheck/taxSettleRevokedBatchSMS',
      data,
    )

/**
 * 发票待结算撤销-短信发送(单条)
 * @param {*} data
 * @returns
 */
export const taxSettleRevokedSMS =
  (data) =>
  getAction(
      '/taxInvoiceCheck/taxSettleRevokedSMS',
      data,
    )

/**
 * 发票待结算撤销-短信发送（批量）
 * @param {*} data
 * @returns
 */
export const revokedBatchSMSByCatalog =
  (data) =>
  getAction(
      '/taxInvoiceCheck/revokedBatchSMSByCatalog',
      data,
    )



/**
 * 重新邀请核验
 * @param {*} data
 * @returns
 */
    export const getEleIssuerAuth =
  (data) =>
  getAction(
      '/electron/tax/password/getEleIssuerAuth',
      data,
    )

/**
 * 发送短信
 * @param {*} data
 * @returns
 */
    export const sendEleIssuerAuthSMS =
  (data) =>
  getAction(
      '/electron/tax/password/sendEleIssuerAuthSMS',
      data,
    )
